<%@page import="org.blog.beans.Blog"%>
<%@page import="org.blog.messages.BlogMessage"%>
<%@page import="org.blog.controller.UserController"%>
<%@page import="org.blog.beans.User"%>
<%@page import="org.blog.messages.RegistrationMessage"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" %>
<%@ page errorPage="../jsp/exceptionHandler.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<jsp:include page="../jsp/cssChoose.jsp" />

<script type="text/javascript" src="js/validation.js"></script>

<title><%= request.getParameter("title") %></title>
</head>
<body>
 	<div id = "container"> 	
 	<jsp:include page="../jsp/header.jsp">
 		<jsp:param value="Blog!" name="title"/>
 	</jsp:include>
 	
	<div id="texts">
	<jsp:include page="../jsp/menu.jsp"/>	
		
		<div id = "content">
			<% if(UserController.isLogged(session)) { %>	
					
				<% BlogMessage bm = (BlogMessage)request.getAttribute("message"); 
				   if(bm == null) bm = new BlogMessage();
				   Blog b = (Blog)session.getAttribute("blog");
				   if(b == null) b = new Blog();
					
				%>
				<form name = "addBlog" method = "post" action = "AddBlog?do=add">
								
					nazwa: <br/>
					<input type="text" name = "name"><br/>
					<div id = "nameE" class = "error"> <%= bm.getName() %> </div>
					
					opis: <br/>
					<textarea rows="5" cols="30" name = "description" ></textarea> <br/>
					<div id = "descriptionE" class = "error"> <%= bm.getDescription() %> </div>
					
					<button type = "submit">dodaj</button>
					
				</form>
				
			<% } else { %>
				Zaloguj sie!
			<% } %>
			
		</div>
		
	</div>
		<jsp:include page="../html/footer.html"/>
						

	</div>
	
</body>
</html>